package org.dreamwork.tools.sdq.model;

import java.net.InetAddress;
import java.util.Objects;

public class Endpoint {
    public final InetAddress address;
    public final int port;

    public long lastHop;
    public int weight;

    public Endpoint (InetAddress address, int port) {
        this.address = address;
        this.port = port;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass () != o.getClass ()) return false;
        Endpoint endpoint = (Endpoint) o;
        return port == endpoint.port && Objects.equals (address, endpoint.address);
    }

    @Override
    public int hashCode () {
        return Objects.hash (address, port);
    }
}
